 
<div class="style-block">
  <form id="characteristics" action="{{collection.url}}" method="get">
    {% if language.not_default? %} <input type="hidden" name="lang" value="{{ language.locale }}"> {% endif %}
    {% if collection.products.size > 0 %}
    <select name="order" style="position: absolute; top: 0px; left: 223px;" onchange="$('#characteristics').submit();">
      {{ "" | select_option: order, "Сортировать" }}
      {{ "price" | select_option: order, "По возрастанию цены" }} 
      {{ "descending_price" | select_option: order, "По убыванию цены" }} 
      {{ "title" | select_option: order, "По алфавиту А-Я" }} 
      {{ "descending_title" | select_option: order, "По алфавиту Я-А" }}
      {{ "age" | select_option: order, "По дате добавления" }} 
    </select>
    {% endif %}
    

		<h2>Цена</h2>
		
		<div class="price-filter-wrap">
			<div class="price-filter">
             От <input type="text" class="txt" id="minCost" value="{% if price_min %}{{price_min}}{% else %}{{ collection.products_price_min | round:0 }}{% endif %}" />
			 до
              <input type="text" class="txt" id="maxCost" value="{% if price_max %}{{price_max}}{% else %}{{ collection.products_price_max | round:0 }}{% endif %}" />
			 р.
			 </div>
          {% if price_min %}<input type="hidden" name="price_min" value="{{price_min}}"/>{% endif %}
          {% if price_max %}<input type="hidden" name="price_max" value="{{price_max}}"/>{% endif %}
			 <input type="submit" class="button" name="" value="Применить" />
		</div>

    
    <script type="text/javascript">
      $('#minCost').focus(function(){   
        if($(this).attr('name') != 'price_min'){
         $('input[name="price_min"]').remove();
        $(this).attr('name', 'price_min');
        }
      });
       $('#maxCost').focus(function(){  
         if($(this).attr('name') != 'price_max'){
          $('input[name="price_max"]').remove();
       $(this).attr('name', 'price_max'); 
         }
      });
 $(function(){
   $('.filter-wrap a').click(function(e){
     e.preventDefault();
     if($(this).hasClass('active')) {
       $(this).removeClass('active').next('input').attr('disabled','disabled');
       $('#characteristics').submit();
     } else {       
       $(this).addClass('active').next('input').removeAttr('disabled');
       $('#characteristics').submit();
     }     
   });
   
   $('.more-params').click(function(e){
    e.preventDefault();
     if ($(this).hasClass('small')) {
     $('.filter-wrap').show();
     $(this).html('Скрыть параметры').removeClass('small');
     } else {
     $('.filter-wrap.hidden').hide();
     $(this).html('Показать все параметры').addClass('small');
     }  
     
   });
 });
</script>
		
    {% if collection.properties.size > 0 %}
     {% for property in collection.properties %}
    <div class="filter-wrap {% if forloop.index > 5 %}hidden{% endif %}">
          <h2>{{property.title}}</h2>
			<ul>
               {% for characteristic in property.characteristics %}
			 <li>
               <a href="#" class="{% if characteristic.current? %}active{% endif %}">{{characteristic.title}} ({{characteristic.products_count}})</a>
               <input name="characteristics[]" type="hidden" value="{{characteristic.id}}" {% unless characteristic.current? %} disabled='disabled' {% endunless %} />
			 </li>
              {% endfor %}
			 
			</ul>
		</div>		
    {% endfor %}
    {% if collection.properties.size > 5 %}
    <p><a href="#" class="more-params small">Показать все параметры</a></p>    
    {% endif %}
    {% endif %}
		
    {% if collection.properties.size > 0 %}
    <input type="button" class="button" onclick="document.location.href='{{collection.url}}'; return false;" value="Сбросить параметры" />
    {% endif %}
  </form>
		</div>